import { GetterTree } from 'vuex'
import { map } from "lodash"
function getDictionary(data: any, key: string): any {
    return map(data[key], (label: any, value: any) => {
        value = value.toString();
        return { value, label }
    })
}
export const getters: GetterTree<any, any> = {
    // 房间字典数据
    roomDictionary(state) {
        return state.roomDictionary;
    },
    // 朝向
    orientations(state) {
        return getDictionary(state.roomDictionary, 'orientations');
    },
    // 房屋类型
    roomAreaType(state) {
        return getDictionary(state.roomDictionary, 'room_area_type');
    },
    // 房屋租赁单元
    roomRentalUnit(state) {
        return getDictionary(state.roomDictionary, 'room_rental_unit');
    },
    // 装修
    renovation(state) {
        return getDictionary(state.roomDictionary, 'renovation');
    },
    // 房屋户型
    roomLayout(state) {
        return getDictionary(state.roomDictionary, 'room_layout');
    },
    // 房屋状态
    roomStatus(state) {
        return getDictionary(state.roomDictionary, 'room_status');
    },
    // 是否招商
    investment(state) {
        return state.investment;
    },
    // 租户类别
    rentUserType(state) {
        return state.rentUserType;
    },
    // 租约状态
    rentContractStatus(state) {
        return state.rentContractStatus;
    }
}